<template>
  <div class="printForm">
    <div class="area-header">
      <span class="area-header-title">{{ $t('申请单') }}</span>
    </div>
    <table class="printTable">
      <tr>
        <td class="tit">{{ $t('巡检日期') }}</td>
        <td>{{ parseTime(form.inspectionTime) }}</td>
        <td class="tit">{{ $t('巡检人员') }}</td>
        <td>{{ form.userName }}</td>
      </tr>
      <tr>
        <td class="tit">{{ $t('巡检情况') }}</td>
        <td colspan="3">{{ form.inspectionCase }}</td>
      </tr>
    </table>
    <!-- 附件列表 -->
    <FileView :list.sync="form.fileList" data-type="deal_inspection" :btn-show="!otherBtnHide" />
  </div>
</template>

<script>
  import { getDealInspection } from '@/api/deal/estate/inspection/dealInspection'

  export default {
    components: {
    },
    data() {
      return {
        openLocation: undefined,
        // 是否隐藏保存按钮
        btnHide: false,
        // 是否隐藏其它按钮
        otherBtnHide: false,
        // 表单参数
        form: {
          // 附件列表
          fileList: []
        },
        // 遮罩层
        loading: false,
        // 操作按钮默认不展示
        buttonShow: true
      }
    },
    created() {
      this.$bus.$emit('async_done')
    },
    methods: {
      // 初始化数据
      init(data) {
        this.loading = true
        if (data != null && data.id !== undefined && data.id !== '' && data.id !== null) {
          this.buttonShow = false
          // 根据ID查询数据
          getDealInspection(data.id).then(response => {
            debugger
            this.form = response.data
            this.loading = false
          })
        }
      }
    }
  }
</script>
